/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.diagram.activity.helper;

import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.DataStoreNode;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.LiteralUnlimitedNatural;
import org.eclipse.uml2.uml.UMLFactory;
import org.eclipse.uml2.uml.UMLPackage;

/**
 * Manages a DataStoreNode
 *
 * @author Gilles Cannenterre
 * @since 29 mars 07
 */
public class NodeDataStoreNodeHelper extends NodeCentralBufferNodeHelper {

	/* (non-Javadoc)
	 * @see com.cea.papyrus.core.common.helper.NodeHelper#createUMLElement(java.lang.String, org.eclipse.uml2.uml.Element)
	 */
	@Override
	public Element createUMLElement(String name, Element umlParent){
		DataStoreNode anObject = null;
		if (umlParent instanceof Activity) {
			anObject = (DataStoreNode) ((Activity)umlParent).createNode(name, UMLPackage.eINSTANCE.getDataStoreNode() );		
			LiteralUnlimitedNatural thenatural=UMLFactory.eINSTANCE.createLiteralUnlimitedNatural();
			thenatural.setValue(LiteralUnlimitedNatural.UNLIMITED);
			anObject.setUpperBound(thenatural);
		}
		return anObject;
	}

	/* (non-Javadoc)
	 * @see com.cea.papyrus.core.common.helper.NodeHelper#getBaseString()
	 */
	@Override
	public String getBaseString() {
		return "DataStoreNode_"; //$NON-NLS-1$
	}

}
